package com.cgw.dmplt.address.dao.ibatis;

import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.address.domain.Province;
import com.cgw.dmplt.address.dao.ProvinceDao;

/**
 *
 */
public class ProvinceDaoImpl extends SqlMapClientDaoSupport implements ProvinceDao
{

    /**
     * insert.
     * @param province province
     * @return id
     */
    public String insertProvince(Province province){
    	getSqlMapClientTemplate().insert("Province_insertProvince", province);
    	return null;
    }

    /**
     * delete.
     * @param province province
     */
    public void deleteProvince(Province province)throws DataAccessException {
        getSqlMapClientTemplate().update("Province_deleteProvince", province);
    }
    
    /**
     * update.
     * @param province province
     */
    public void updateProvince(Province province){
    	getSqlMapClientTemplate().update("Province_updateProvince", province);
    }
    
    /**
     * find.
     * @param id id
     * @return province
     */
    public Province findProvince(Integer pk){
        Province province = (Province) getSqlMapClientTemplate().queryForObject("Province_findProvince", pk);
        return province;
    }
    
    /**
     * list.
     * @param province province
     * @return province list
     */
    public List listProvince(Province province){
        List list = getSqlMapClientTemplate().queryForList("Province_listProvince", province);
        return list;
    }  
    
    /**
     * listCount.
     * @param province province
     * @return list count
     */
    public Integer listProvinceCount(Province province){
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("Province_listProvinceCount", province);
        return count;
    }  
}
